import { Component, OnInit, ViewChild, ViewContainerRef, ComponentRef, ComponentFactoryResolver, EventEmitter } from '@angular/core';
import * as _ from 'lodash';
import { ModifyPageComponent } from "../../content/modify-page/modify-page.component";
@Component({
  selector: 'app-modify',
  templateUrl: './modify.component.html',
  styleUrls: ['./modify.component.scss']
})
export class ModifyComponent implements OnInit {
  // 模版
  @ViewChild("nqdiiModifyPage", { read: ViewContainerRef })
  nqdiiModifyPage: ViewContainerRef;
  modifyPageComponent: ComponentRef<ModifyPageComponent>;
  constructor(
    public resolver: ComponentFactoryResolver,
  ) { }

  ngOnInit() {
    if (this.modifyPageComponent && this.modifyPageComponent.instance) {
      this.modifyPageComponent.destroy();
    }
    const modifyPageComponent = this.resolver.resolveComponentFactory(ModifyPageComponent);
    this.modifyPageComponent = this.nqdiiModifyPage.createComponent(modifyPageComponent);
  }

}
